#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 crane <crane@crane-pc>
#
# Distributed under terms of the MIT license.

"""

"""

class MyQueue:
    def __init__(self):
        self.push_stack = []
        self.pop_stack = []

    def _adjust(self):
        if self.pop_stack:
            return
        while self.push_stack:
            self.pop_stack.append(self.push_stack.pop())

    def push(self, element):
        self.push_stack.append(element)

    def pop(self):
        self._adjust()
        return self.pop_stack.pop()

    def top(self):
        self._adjust()
        return self.pop_stack[-1]


def main():
    print("start main")
    q = MyQueue()
    q.push(1)
    q.push(2)
    q.push(3)
    print(q.pop())
    print(q.pop())
    q.push(4)
    print(q.pop())
    print(q.pop())

if __name__ == "__main__":
    main()
